﻿@using Digital.WCFClient.ConfigService
@using System.Collections.ObjectModel
@using Digital.Common.Mvc.Extensions
@using Digital.Web.Controllers
@using Microsoft.AspNet.Identity
@using Digital.Common.Utilities
@model Digital.WCFClient.ConfigService.SinglePageModel
@{
    ViewBag.Title = "单页管理";
    Layout = "~/Views/Shared/_LayoutDigital.cshtml";
}
@section PageSpecificJavascriptIncludes{
    <link rel="stylesheet" href="../DigitalStyle/css/jquery.gritter.css" />

    <script src="../DigitalStyle/js/jquery.gritter.min.js"></script>
    <script src="../DigitalStyle/js/jquery.validate.min.js"></script>
    <script src="../DigitalStyle/js/JqueryToken.js"></script>
    <script src="../DigitalStyle/js/messages_cn.js"></script>
    <!-- ckeditor -->
    <script src="../DigitalStyle/js/ckeditor/ckeditor.js"></script>
    <script src="../DigitalStyle/js/ckeditor/adapters/jquery.js"></script>
}

<div class="pageheader">
    <h2><i class="fa fa-user"></i> 单独页面 <span>企业单页管理</span></h2>
    <div class="breadcrumb-wrapper">
        <span class="label">你的位置:</span>
        <ol class="breadcrumb">
            <li><a href="">企业中心</a></li>
            <li class="active">单页管理</li>
        </ol>
    </div>
</div>

<div class="contentpanel">
    <div class="row">
        <div class="alert alert-warning">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <strong>提示：</strong> 类似企业介绍的关于我们、联系我们、荣誉证书等统称为单独页面，页面标示的作用用于将 指定的页面聚合在一起 形成链接.<br> 单独页面添加上限为30页。
        </div>
        @Html.AntiForgeryToken()
        <div class="col-md-12">
            <div class="table-responsive">
                <table class="table table-info mb30">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>页面名称</th>
                            <th>聚合标示</th>
                            <th>修改时间</th>
                            <th>管理</th>
                        </tr>
                    </thead>
                    <tbody>
                        @{
                            if (ViewBag.PageList != null)
                            {
                                foreach (var PageMode in (List<SinglePageModel>)ViewBag.PageList)
                                {
                                    <tr>
                                        <td>@PageMode.PageID</td>
                                        <td>@PageMode.PageTitle</td>
                                        <td>@PageMode.PageRelationFlag</td>
                                        <td>@PageMode.ModifiedTime</td>
                                        <td><a class="btn btn-primary" onclick="javascript:Delete(@PageMode.PageID)"><i class="fa fa-pencil mr5"></i> 删除</a>&nbsp;<a class="btn btn-primary" href="CompanySinglePageAdd?Id=@PageMode.PageID" ><i class="fa fa-pencil mr5"></i> 修改</a></td>
                                    </tr>
                                }
                            }

                        }

                        

                    </tbody>
                </table>
            </div><!-- table-responsive -->
        </div>

    </div>
</div>

<script>

    function callBack() {
        window.location = window.location;
    }

    function Delete(Id)
    {
        ComAjax("/Company/CompanySinglePageDelete", { Id:Id}, "单页删除", "callBack");
    }
    jQuery(document).ready(function () {

        window.onload = function () {
            // Listen to the double click event.
            if (window.addEventListener)
                document.body.addEventListener('dblclick', onDoubleClick, false);
            else if (window.attachEvent)
                document.body.attachEvent('ondblclick', onDoubleClick);
        };

        function onDoubleClick(ev) {
            // Get the element which fired the event. This is not necessarily the
            // element to which the event has been attached.
            var element = ev.target || ev.srcElement;

            // Find out the div that holds this element.
            var name;

            do {
                element = element.parentNode;
            }
            while (element && (name = element.nodeName.toLowerCase()) &&
                (name != 'div' || element.className.indexOf('editable') == -1) && name != 'body');

            if (name == 'div' && element.className.indexOf('editable') != -1)
                replaceDiv(element);
        }
        var editor;
        function replaceDiv(div) {
            if (editor)
                editor.destroy();
            editor = CKEDITOR.replace(div);
        }

    });
</script>


